package com.cloud.form.api.provider;

import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

import com.cloud.form.api.bean.FormRepositoryCriteria;

public class RepoFormDefProvider {
	private static final String LIST_PAGE_SELECT = "form_id, form_name, print_snapshot_path",
			LIST_PAGE_FOMR = "repo_form_def";

	public String listPage(FormRepositoryCriteria bean) {
		SQL sql = new SQL().SELECT(LIST_PAGE_SELECT).FROM(LIST_PAGE_FOMR);
		if (!StringUtils.isEmpty(bean.getFormName())) {
			bean.setFormName("%" + bean.getFormName() + "%");
			sql.WHERE("form_name like #{formName}");
		}
		return sql.toString();
	}
}
